package com.demo.designmode.proxy.case1;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/xiaoniu")
public class UserController {

    @Resource
    private UserService userService;

    @GetMapping("/getAllUser")
    public List<User> getAllUser() throws Exception {
        //获取代理对象
        UserService userServiceProxy = new LogRecordProxy<>(userService).getProxy();
        return userServiceProxy.getAllUser();
    }
}